<?php if ($param_option):?>


<script src="/public/js/bootstrap-select-1.12.4/dist/js/bootstrap-select.min.js"></script>
<link rel="stylesheet" type="text/css" href="/public/js/bootstrap-select-1.12.4/dist/css/bootstrap-select.css" />
<link rel="stylesheet" type="text/css" href="/public/css/cate.css" />
<link rel="stylesheet" type="text/css" href="/public/css/font-awesome.min.css" />





<section class="panel">
    <header class="panel-heading">
        搜索

        <span class="tools pull-right">
            <?php if($action_link):?>
            <?php foreach ($action_link as $item) : ?>
                <a href="<?php echo $item['href'];?>" data-toggle="modal" class="btn btn-primary"><?php echo $item['name'];?></a>
            <?php endforeach;?>
            <?php endif;?>
            <a class="fa fa-refresh" href="<?php echo base_url('product/index/page/') . "?clear=1";?>"></a>
            <a class="fa fa-chevron-down" href="javascript:;"></a>
         </span>
    </header>
    <div class="panel-body" style="padding-bottom: 0;">
        <div class="row-search">
            <div class="row">
                <form action="" method="get">
                    <?php foreach ($param_option as $k_name => $item) :?>
                        <div class="form-group <?php echo $item['col'];?>">
                            <?php if ($item['type'] == 'text') :?>
                                <input name="<?php echo $k_name;?>" value="<?php echo $param[$k_name];?>" placeholder="<?php echo $item['placeholder'];?>" type="<?php echo $item['type'];?>" class="form-control" aria-controls="dynamic-table">
                            <?php elseif ($item['type'] == 'text-c') :?>
                                <div class="input-group">
                                    <input type="text" name="<?php echo $k_name;?>" placeholder="<?php echo $item['placeholder'];?>" value="<?php echo $param[$k_name];?>" class="form-control">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="selected"><?php echo $param[$item['item']['name']] ? $item['item']['option'][$param[$item['item']['name']]] : $item['item']['placeholder'];?></span> <span class="caret"></span></button>
                                        <input type="hidden" name="<?php echo $item['item']['name'];?>" value="<?php echo $param[$item['item']['name']];?>" />
                                        <ul class="dropdown-menu pull-right">
                                            <li><a data-id="0" href="#"><?php echo $item['item']['placeholder'];?></a></li>
                                            <?php foreach ($item['item']['option'] AS $k => $option) :?>
                                                <li><a data-id="<?php echo $k;?>" href="#"><?php echo $option;?></a></li>
                                            <?php endforeach;?>
                                        </ul>
                                    </div>
                                </div>
                            <?php elseif ($item['type'] == 'dpd_time' || $item['type'] == 'dpd'):?>
                                <div class="input-group input-large custom-date-range">
                                    <input type="text" autocomplete="off" class="form-control <?php echo $item['type'] == 'dpd_time' ? 'dpd1' : '';?>" name="<?php echo $k_name;?>_start" value="<?php echo $param[$k_name.'_start']; ?>">
                                    <span class="input-group-addon"><?php echo $item['placeholder'];?></span>
                                    <input type="text" autocomplete="off" class="form-control <?php echo $item['type'] == 'dpd_time' ? 'dpd2' : '';?>" name="<?php echo $k_name?>_end" value="<?php echo $param[$k_name.'_end']; ?>">
                                </div>
                            <?php elseif ($item['type'] == 'option') :?>
                                <select name="<?php echo $k_name;?>" class="form-control">
                                    <option value="-1"><?php echo $item['placeholder'];?></option>
                                    <?php foreach ($item['option'] as $k => $val) :?>
                                        <option <?php echo $param[$k_name] == $k ? 'selected="selected"' : '';?> value="<?php echo $k;?>"><?php echo $val;?></option>
                                    <?php endforeach;?>
                                </select>

                            <?php elseif ($item['type'] == 'option_cat') :?>

                                <select name="<?php echo $k_name;?>" class="form-control">
                                    <option>选择分类</option>

                                    <?php foreach ($item['option'] as $k => $val) :?>
                                    <?php
                                        if($val['level']==0){
                                            ?>

                                            <option class="top_cate"  <?php echo $param[$k_name] == $val['cate_id'] ? 'selected="selected"' : '';?> value="<?php echo $val['cate_id'];?>" ><?=$val['cate_name'].'('.$val['count'].')'?></option >
                                            <?php
                                        }elseif ($val['level']==1){
                                            ?>

                                            <div>
                                                <option class="" <?php echo $param[$k_name] == $val['cate_id'] ? 'selected="selected"' : '';?> value="<?php echo $val['cate_id'];?>" ><?=str_repeat('&nbsp;',$val['level']).$val['cate_name'].'('.$val['count'].')'?></option >
                                            </div>
                                            <?php
                                        }
                                        ?>

                                    <?php endforeach;?>
                                </select>





                                <!-- <select name="<?php echo $k_name;?>" data-live-search-placeholder="搜索分类" data-live-search="true" class="form-control selectpicker">
                                    
                                </select> -->
                            
                            <?php elseif ($item['type'] == 'cal_option') :?>
                                
                                <select name="<?php echo $k_name;?>" class="form-control">
                                    <option value="0"><?php echo $item['placeholder'];?></option>
                                    <?php foreach ($item['option'] as $k => $val) :?>
                                        <option <?php echo $param[$k_name] == $k ? 'selected="selected"' : '';?> value="<?php echo $k;?>"><?php echo $val;?></option>
                                    <?php endforeach;?>
                                </select>
                            <?php elseif ($item['type'] == 'siteweb') :?>
                            <select name="<?php echo $k_name;?>" class="form-control">
                                <option value="0"><?php echo $item['placeholder'];?></option>
                                <?php foreach ($item['option'] as $k => $val) :?>
                                    <option <?php echo $param[$k_name] == $k ? 'selected="selected"' : '';?> value="<?php echo $k;?>"><?php echo $val;?></option>
                                <?php endforeach;?>
                            </select>


                            <?php endif;?>

                        </div>

                    <?php endforeach;?>
                    <?php if($param['prepare_state']){?>
                        <input name="prepare_state" type="hidden" value="<?php echo $param['prepare_state']?>" class="form-control" aria-controls="dynamic-table">
                    <?php }?>
                    <div class="form-group col-lg-2">
                        <button class="btn btn-info" type="submit">搜索</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
<?php endif;?>
<?php if ($supp_list) : ?>
<section class="panel">
    <div class="panel-body" style="padding-bottom: 0;">
        <div class="row-operate icheck">
            <div class="row">
                <?php foreach ($supp_list as $k => $val):?>
                    <div class="flat-green single-row col-lg-2">
                        <div class="radio ">
                            <input tabindex="3" value="<?php echo $k;?>" type="radio"  name="demo-radio">
                            <label><?php echo $val;?>（90） </label>
                        </div>
                    </div>
                <?php endforeach;?>
            </div>
        </div>
    </div>
</section>
<?php endif;?>
<script type="text/javascript">

    $(function () {
        $('.dropdown-menu a').click(function () {
            $(this).parents('ul').prevAll('button').find('.selected').html($(this).html());
            $(this).parents('ul').prev('input').val($(this).attr('data-id'));
        });
    });

</script>
